package com.ruoyi.mapper;

import com.ruoyi.domain.vo.BehaviorPunchingRecordVo;
import com.ruoyi.domain.vo.BehaviorRecodeVo;
import com.ruoyi.domain.vo.BehaviorVo;
import com.ruoyi.domain.vo.BehaviorsCo2ReductionVo;
import com.ruoyi.system.domain.Behavior;
import com.ruoyi.system.domain.BehaviorRecode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface LowCarbonBehaviorMapper {
    List<BehaviorsCo2ReductionVo> getBehaviorsCo2Reduction(Long userId);

    void behaviorPunchCard(BehaviorPunchingRecordVo behaviorPunchingRecordVo);
    /**
     *  添加低碳行为和记录
     */
    //public int insertLowCarbonBehavior(BehaviorVo behavior);

    Double getReduceCo2Today(@Param("userId") Long userId,
                           @Param("behaviorCode") Long behaviorCode,
                           @Param("today") LocalDate today);

    Double getReduceCo2LimitationByBehaviorCode(Long behaviorCode);

    int BehaviorPunchCard(BehaviorRecode behaviorRecode);

    Long getBehaviorCodeByName(String behaviorName);

    String getBehaviorTypeIdByType(String behaviorType);

    Double getReduceCo2ByBehaviorValue(@Param("behaviorValue") Double behaviorValue, @Param("behaviorCode") Long behaviorCode);

    void behaviorPunchCardSub(@Param("behaviorPunchingRecordVo") BehaviorPunchingRecordVo behaviorPunchingRecordVo, @Param("reduceCo2") Double reduceCo2);

    List<BehaviorVo> getLowCarbonBehaviorList();

    // 更新用户减碳量和积分
    void updateUserCo2Reduction(BehaviorPunchingRecordVo behaviorPunchingRecordVo);

    void updateUserCo2ReductionSub(@Param("behaviorPunchingRecordVo") BehaviorPunchingRecordVo behaviorPunchingRecordVo, @Param("reduceCo2") Double reduceCo2);

    Double getConversionRateByBehaviorCode(Long behaviorCode);
}
